package com.ld.security.shop.crawler.base.controller;

import com.ld.security.auth.common.anno.IgnoreUserToken;
import com.ld.security.common.core.base.po.PagePo;
import com.ld.security.common.core.base.vo.DataVo;
import com.ld.security.common.core.base.vo.PageVo;
import com.ld.security.shop.crawler.base.entity.SeaBook;
import com.ld.security.shop.crawler.base.service.ISeaBookService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/seaBook")
@IgnoreUserToken
public class SeaBookApi {

    @Autowired
    private ISeaBookService iSeaBookService;

    @RequestMapping(value = "search",method = RequestMethod.POST)
    @ApiOperation("关键字搜索")
    public DataVo search( PagePo<String> po){
        PageVo vo = iSeaBookService.search(po);
        return DataVo.of(vo);
    }

    @RequestMapping(value = "query",method = RequestMethod.POST)
    @ApiOperation("搜索")
    public DataVo query(@RequestBody PagePo<SeaBook> po){
        PageVo vo = iSeaBookService.page(po);
        return DataVo.of(vo);
    }

}
